import { createParamDecorator, ExecutionContext } from '@nestjs/common'

export const CheckId = createParamDecorator(
  (value: string, ctx: ExecutionContext): boolean => {
    const { user, params } = ctx.switchToHttp().getRequest()
    const { id } = params
    return user.id === id
  }
)
